home *** CD-ROM | disk | FTP | other *** search
/ Game Programming in C++ - Start to Finish / GameProgrammingS.iso / developer_install / CEGUISDK-0.4.1-VC6-STLport.exe / {app} / Samples / common / include / CEGuiBaseApplication.h next >
C/C++ Source or Header  |  2005-08-20  |  3KB  |  112 lines

  1. /************************************************************************
  2.     filename:   CEGuiBaseApplication.h
  3.     created:    24/9/2004
  4.     author:     Paul D Turner
  5. *************************************************************************/
  6. /*************************************************************************
  7.     Crazy Eddie's GUI System (http://www.cegui.org.uk)
  8.     Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
  9.  
  10.     This library is free software; you can redistribute it and/or
  11.     modify it under the terms of the GNU Lesser General Public
  12.     License as published by the Free Software Foundation; either
  13.     version 2.1 of the License, or (at your option) any later version.
  14.  
  15.     This library is distributed in the hope that it will be useful,
  16.     but WITHOUT ANY WARRANTY; without even the implied warranty of
  17.     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  18.     Lesser General Public License for more details.
  19.  
  20.     You should have received a copy of the GNU Lesser General Public
  21.     License along with this library; if not, write to the Free Software
  22.     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  23. *************************************************************************/
  24. #ifndef _CEGuiBaseApplication_h_
  25. #define _CEGuiBaseApplication_h_
  26.  
  27. /*************************************************************************
  28.     Forward refs
  29. *************************************************************************/
  30. class CEGuiSample;
  31.  
  32.  
  33. /*!
  34. \brief
  35.     Base application abstract base class.
  36.  
  37.     The "BaseApplication" family of classes are used to start up and execute a host application for
  38.     CeGui samples in a consistent manner.
  39. */
  40. class CEGuiBaseApplication
  41. {
  42. public:
  43.     /*!
  44.     \brief
  45.         Constructor.
  46.     */
  47.     CEGuiBaseApplication() :
  48.         d_quitting(false)
  49.     { }
  50.  
  51.  
  52.     /*!
  53.     \brief
  54.         Destructor
  55.     */
  56.     virtual ~CEGuiBaseApplication()
  57.     { }
  58.  
  59.  
  60.     /*!
  61.     \brief
  62.         Start the base application
  63.  
  64.         This will fully initialise the application, finish initialisation of the demo via calls to 'sampleApp', and finally
  65.         control execution of the sample.
  66.  
  67.     \param sampleApp
  68.         Pointer to the CEGuiSample object that the CEGuiBaseApplication is being invoked for.
  69.  
  70.     \return
  71.         - true if the application initialised and ran okay (cleanup call is required).
  72.         - false if the application failed to initialise (no cleanup call is required).
  73.     */
  74.     virtual bool execute(CEGuiSample* sampleApp) = 0;
  75.  
  76.  
  77.     /*!
  78.     \brief
  79.         Performs any required cleanup of the base application system.
  80.     */
  81.     virtual void cleanup() = 0;
  82.  
  83.  
  84.     /*!
  85.     \brief
  86.         Set whether the BaseApplication should clean up and exit.
  87.  
  88.     \param quit
  89.         - true if the application should clean up and exit.
  90.  
  91.     \return
  92.         Nothing.
  93.     */
  94.     virtual void setQuitting(bool quit = true)      { d_quitting = quit; }
  95.  
  96.  
  97.     /*!
  98.     \brief
  99.         Return whether the app is currently set to quit.
  100.  
  101.     \return
  102.         - true if the application will terminate at its earliest opportunity.
  103.         - false if the application will keep running.
  104.     */
  105.     virtual bool isQuitting() const     { return d_quitting; }
  106.  
  107. protected:
  108.     bool    d_quitting;     //!< true when the base app should cleanup and exit.
  109. };
  110.  
  111. #endif  // end of guard _CEGuiBaseApplication_h_
  112.